package com.k.action;

import java.util.Map;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.json.annotations.JSON;

import com.k.Service.LoginService;
import com.opensymphony.xwork2.ActionContext;

@ParentPackage("json-default") 
@Namespace("/manage")
@Results({ 
	@Result(type="json",params ={"root", "jsobject"}),
	@Result(name = "login", location = "/MyJspSuccess.jsp"),	
	@Result(name = "error", location = "/manage/login.jsp") })
public class UserManage extends BaseAction{
	private LoginService loginservice;
	/**
	 * @return
	 */
	@JSON(serialize = false) 
	public String GetUser() {
		// TODO Auto-generated method stub
		Map session = ActionContext.getContext().getSession();
		com.k.Model.Login user = (com.k.Model.Login) session.get("userAdmin");
		jsobject=new JSONObject().fromObject(user);
		return SUCCESS;
	}
	private JSONObject jsobject;
	
	public JSONObject getJsobject() {
		  return jsobject;
	}

	public void setJsobject(JSONObject jsobject) {
		  this.jsobject = jsobject;
	}

	public void setLoginservice(LoginService loginservice) {
		this.loginservice = loginservice;
	} 
	
	@Override
	public String delete() throws Exception {
		return null;
	}
	@Override
	public String list() throws Exception{
		return null;
	}
	@Override
	public String update() throws Exception{
		return null;
	}
	@Override
	public String save() throws Exception{
		return null;
	}
}
